package cn.sdhuijin.healthexam.activity;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sdhuijin.healthexam.ExitApplication;
import cn.sdhuijin.healthexam.R;
import cn.sdhuijin.healthexam.control.AbstractControlActivity;

/**
 * 满月儿童健康检查记录表
 * 
 * @author sunping
 */
public class ManYueVisitInfoActivity extends AbstractControlActivity implements
		OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_manyue_info);
		ExitApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		// 获取传递过来的sql语句
		String fileName = intent.getStringExtra("filename");

		addTextView(R.id.txt_user_name, "姓名");
		addTextView(R.id.txt_identify_num, "身份证号");
		addTextView(R.id.txt_tizhong, "体重");
		addTextView(R.id.txt_tizhong_level, "体重等级_content");
		addTextView(R.id.txt_shenchang, "身长");
		addTextView(R.id.txt_shenchang_level, "身长等级_content");
		addTextView(R.id.txt_touwei, "头围");
		addTextView(R.id.txt_mianse, "面色_content");
		addTextView(R.id.txt_pifu, "皮肤_content");
		addTextView(R.id.txt_qianxin_first, "前囟一");
		addTextView(R.id.txt_qianxin_second, "前囟二");
		addTextView(R.id.txt_qianxin, "前囟闭合与否_content");
		addTextView(R.id.txt_jingbubaokuai, "颈部包块_content");
		addTextView(R.id.txt_yanwaiguan, "眼外观_content");
		addTextView(R.id.txt_erwaiguan, "耳外观_content");
		addTextView(R.id.txt_chuyashu, "出牙数");
		addTextView(R.id.txt_xinfei, "心肺_content");
		addTextView(R.id.txt_fubu, "腹部_content");
		addTextView(R.id.txt_jidai, "脐部_content");
		addTextView(R.id.txt_jidai_qt, "脐部其他");
		addTextView(R.id.txt_sizhi, "四肢_content");
		addTextView(R.id.txt_gouloubing, "可疑佝偻病体征_content");
		addTextView(R.id.txt_waishengzhiqi, "肛门/外生殖器_content");
		addTextView(R.id.txt_xuehongdanbai, "血红蛋白值");
		addTextView(R.id.txt_huwaihuodong, "户外活动");
		addTextView(R.id.txt_weishengsu, "服用维生素D");
		addTextView(R.id.txt_fayupinggu, "发育评估_content");
		addTextView(R.id.txt_huanbingqingkuang, "两次随访间患病情况_content");
		addTextView(R.id.txt_qita, "其他");
		addTextView(R.id.txt_zd, "指导_content");
		addTextView(R.id.txt_zhuanzhen, "转诊_content");
		addTextView(R.id.txt_zhuanzhen_yy, "转诊原因");
		addTextView(R.id.txt_zhuanzhen_jgjks, "机构及科室");
		addTextView(R.id.txt_next_date, "下次随访日期");
		addTextView(R.id.txt_visit_doctor, "随访医生签名");
		addTextView(R.id.txt_suggestion, "指导意见");

		setButtonListener(this, R.id.btn_back);

		Properties prop = new Properties();
		try {
			File f = new File(Environment.getExternalStorageDirectory()
					.getPath() + "/health/" + fileName + ".txt");
			if (f.exists()) {

				controlManager.setPropertiesPath(f.getAbsolutePath());
				controlManager.toControl();

				prop.load(new FileReader(f.getAbsolutePath()));
			} else {
				this.toastInformation(R.string.record_deleted);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void onClick(View v) {
		int clickId = (Integer) v.getId();
		switch (clickId) {
		case R.id.btn_back:
			finish();
			break;
		default:
			break;
		}
	}

}